QuickTime 3 Reference

Previous | Chapter Top | Chapter Contents | Next

Functions Implemented by Music Components that Use the Generic Music Component

The following functions are implemented by client music components of the generic music component. They are called by the generic music component, which make calls that are necessary for responding to function calls made directly by applications.

MusicDerivedSetKnob

The generic music component calls your music component's MusicDerivedSetKnob function when any of the synthesizer's knobs are altered.

pascal ComponentResult (
                     MusicComponent mc,
                     long knobType,
                     long knobNumber,
                     long knobValue,
                     long partNumber,
                     Part *p,
                     GenericKnobDescription *gkd)
                     ComponentCallNow (kMusicDerivedSetKnobSelect,24);
mc
Specifies the instance of the generic music component. Your software obtains this reference when calling the Component Manager's OpenComponent or OpenDefaultComponent function.
knobType
Specifies the type of knob that has been altered.
knobNumber
Specifies the number of the knob that has been altered.
knobValue
Specifies the new value of the altered knob.
partNumber
Specifies the number of the part whose knob has been altered.
p
A pointer to the part whose knob has been altered.
gkd
A generic knob description record for the knob.

DISCUSSION

This function is called when any knob on the synthesizer is altered. It should look at the Part record and the GenericKnobDescription record and address the synthesizer hardware appropriately to set the new knob value. For a MIDI device, this means to construct a system-exclusive MIDI packet, and send it to the MIDI routine received by the MusicDerivedSetMIDI call.

These are the possible values for the knobType parameter:

/* knobTypes for MusicDerivedSetKnob */
#define kGenericMusicKnob 1
#define kGenericMusicInstrumentKnob 2
#define kGenericMusicDrumKnob 3

RESULT CODES

To be provided.

MusicDerivedSetPart

The generic music component calls your music component's MusicDerivedSetPart function to use the polyphony for the part specified in the Part record.

pascal ComponentResult MusicDerivedSetPart (
                     MusicComponent mc,
                     long partNumber,
                     Part *p)
                     ComponentCallNow (kMusicDerivedSetPartSelect, 8);
mc
Specifies the instance of the generic music component. Your software obtains this reference when calling the Component Manager's OpenComponent or OpenDefaultComponent function.
partNumber
Specifies the number of the part for this operation.
p
A pointer to the part for this operation.

RESULT CODES

To be provided.

MusicDerivedSetInstrument

The generic music component calls your music component's MusicDerivedSetInstrument function to get the complete instrument defined by the Part record to the synthesizer. This will either be by hardware addressing in the case of a NuBus card, or by constructing a MIDI packet for an external synthesizer.

pascal ComponentResult MusicDerivedSetInstrument (
                     MusicComponent mc,
                     long partNumber,
                     Part *p)
                     ComponentCallNow (kMusicDerivedSetInstrumentSelect,8);
mc
Specifies the instance of the generic music component. Your software obtains this reference when calling the Component Manager's OpenComponent or OpenDefaultComponent function.
partNumber
Specifies the number of the part for this operation.
p
A pointer to the part for this operation.

RESULT CODES

To be provided.

MusicDerivedSetInstrumentNumber

The generic music component calls your music component's MusicDerivedSetInstrumentNumber function to set the specified part to the instrument number in the Part record.

pascal ComponentResult MusicDerivedSetInstrumentNumber (
                     MusicComponent mc,
                     long partNumber,
                     Part *p)
                     ComponentCallNow (kMusicDerivedSetInstrumentNumberSelect,8);
mc
Specifies the instance of the generic music component. Your software obtains this reference when calling the Component Manager's OpenComponent or OpenDefaultComponent function.
partNumber
Specifies the number of the part for this operation.
p
A pointer to the part for this operation.

DISCUSSION

For a MIDI device that either only supports instruments from 0 to 127, or that supports one of the standard bank-switching controller messages, this call should not be needed. You would set the kGenericMusicBank0 or kGenericMusicBank32 (or both) flags, instead.

RESULT CODES

To be provided.

MusicDerivedSetMIDI

The generic music component calls your music component's MusicDerivedSetMIDI function to set the MIDI channel and other MIDI settings for MIDI output only. It sends MIDI out to the synthesizer.

pascal ComponentResult MusicDerivedSetMIDI(
                     MusicComponent mc,
                     MusicMIDISendProcPtr midiProc,
                     long refcon,
                     long midiChannel)
                     ComponentCallNow (kMusicDerivedSetMIDISelect,12);
mc
Specifies the instance of the generic music component. Your software obtains this reference when calling the Component Manager's OpenComponent or OpenDefaultComponent function.
midiProc
A pointer to the function in your music component for performing MIDI output.
refcon
A reference constant sent the function specified by the midiProc parameter.
midiChannel
Specifies the MIDI channel to use for the operation.

DISCUSSION

A derived component for a MIDI synthesizer will receive this call soon after it is opened. It should store the midiProc , refCon , and midiChannel in its globals. When the derived component needs to communicate with the synthesizer, it will call the midiProc with this refCon . The midiChannel variable specifies the "system channel" of the device.

RESULT CODES

To be provided.

MusicDerivedStoreInstrument

The generic music component calls your music component's MusicDerivedStoreInstrument function to store the specified instrument in a user instrument location.

pascal ComponentResult MusicDerivedStoreInstrument (
                     MusicComponent mc,
                     long partNumber,
                     Part *p,
                     long instrumentNumber )
                     ComponentCallNow (kMusicDerivedStoreInstrumentSelect,8);
mc
Specifies the instance of the generic music component. Your software obtains this reference when calling the Component Manager's OpenComponent or OpenDefaultComponent function.
partNumber
Specifies the number of the part for this operation.
p
A pointer to the part for this operation.
instrumentNumber
Specifies the number of the instrument to store.

RESULT CODES

To be provided.


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next